/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dialogview;

import bo.EmployeeBO;
import bo.VacancyfilldetailsBO;
import data.Employees;
import data.Vacancies;
import java.awt.event.KeyEvent;
import javax.swing.JOptionPane;
import view.ManageVacancy;

/**
 *
 * @author Hùng
 */
public class FillVacancyDialog extends javax.swing.JDialog {

    /**
     * Creates new form FillVacanyDialog
     */
    static Employees sEmp;

    public static Employees getsEmp() {
        return sEmp;
    }

    public static void setsEmp(Employees sIdEmp) {
        FillVacancyDialog.sEmp = sIdEmp;
    }

   

    public FillVacancyDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        Vacancies tmpVac = ManageVacancy.getsVacancies();
        txtNameDept.setText(tmpVac.getDepartments().getDeptname());
        if (tmpVac.getSections() != null) {
            txtNameSec.setText(tmpVac.getSections().getSectname());
        }
        txtNameDesign.setText(tmpVac.getDesignation().getDesignation());
        txtIdVac.setText(tmpVac.getVacancyid());
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        pRegister1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        lbEUser1 = new javax.swing.JLabel();
        txtUserE1 = new javax.swing.JTextField();
        lbEPass1 = new javax.swing.JLabel();
        lbERole1 = new javax.swing.JLabel();
        btnEdit1 = new javax.swing.JButton();
        btnAdd1 = new javax.swing.JButton();
        cbRoleE1 = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        txtPassE1 = new javax.swing.JPasswordField();
        txtIdE1 = new javax.swing.JTextField();
        lbDeptnum1 = new javax.swing.JLabel();
        lbEName1 = new javax.swing.JLabel();
        lbDesignName1 = new javax.swing.JLabel();
        lbSecName1 = new javax.swing.JLabel();
        txtNameE1 = new javax.swing.JTextField();
        lbEEmail1 = new javax.swing.JLabel();
        lbEFax1 = new javax.swing.JLabel();
        lbEPhone1 = new javax.swing.JLabel();
        lbEAddress1 = new javax.swing.JLabel();
        txtAddressE1 = new javax.swing.JTextField();
        txtPhoneE1 = new javax.swing.JTextField();
        txtFaxE1 = new javax.swing.JTextField();
        txtEmailE1 = new javax.swing.JTextField();
        txtflag1 = new javax.swing.JTextField();
        txtNameDept = new javax.swing.JTextField();
        txtNameSec = new javax.swing.JTextField();
        txtNameDesign = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtIdVac = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        pRegister1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        pRegister1.setDoubleBuffered(false);
        pRegister1.setPreferredSize(new java.awt.Dimension(724, 433));

        jLabel3.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Register  Employee ");

        lbEUser1.setText("UserName                  :");

        lbEPass1.setText("Password                 :");

        lbERole1.setText("Role                         :");

        btnEdit1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Button-Close-icon.png"))); // NOI18N
        btnEdit1.setText("Cancel");
        btnEdit1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEdit1ActionPerformed(evt);
            }
        });

        btnAdd1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Accept-icon.png"))); // NOI18N
        btnAdd1.setText("Add");
        btnAdd1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdd1ActionPerformed(evt);
            }
        });

        cbRoleE1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Admin", "Hrmanager", "Employee" }));
        cbRoleE1.setToolTipText("");

        jLabel4.setFont(new java.awt.Font("Arial", 0, 8)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 0, 0));
        jLabel4.setText("Password have more than 6 charaters");

        lbDeptnum1.setText("Department Name      :");

        lbEName1.setText("Employee Name         :");

        lbDesignName1.setText("Designation Name     :");

        lbSecName1.setText("Section Name            :");

        lbEEmail1.setText("Employee Email          :");

        lbEFax1.setText("Employee Fax           :");

        lbEPhone1.setText("Employee Phone        :");

        lbEAddress1.setText("Employee Address    :");

        txtPhoneE1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtPhoneE1ActionPerformed(evt);
            }
        });
        txtPhoneE1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtPhoneE1KeyTyped(evt);
            }
        });

        txtFaxE1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtFaxE1KeyTyped(evt);
            }
        });

        txtNameDept.setEditable(false);

        txtNameSec.setEditable(false);

        txtNameDesign.setEditable(false);

        jLabel5.setText("Vacancy Id                :");

        txtIdVac.setEditable(false);

        javax.swing.GroupLayout pRegister1Layout = new javax.swing.GroupLayout(pRegister1);
        pRegister1.setLayout(pRegister1Layout);
        pRegister1Layout.setHorizontalGroup(
            pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pRegister1Layout.createSequentialGroup()
                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(pRegister1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(txtAddressE1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pRegister1Layout.createSequentialGroup()
                        .addContainerGap(21, Short.MAX_VALUE)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pRegister1Layout.createSequentialGroup()
                                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(pRegister1Layout.createSequentialGroup()
                                        .addComponent(lbEUser1)
                                        .addGap(194, 194, 194))
                                    .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addGroup(pRegister1Layout.createSequentialGroup()
                                            .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(lbDesignName1, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(lbSecName1)
                                                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(lbDeptnum1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING)))
                                            .addGap(18, 18, 18)
                                            .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(txtUserE1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                    .addComponent(txtNameDept)
                                                    .addComponent(txtNameSec)
                                                    .addComponent(txtNameDesign)
                                                    .addComponent(txtIdVac, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                        .addGroup(pRegister1Layout.createSequentialGroup()
                                            .addComponent(lbEPass1)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(txtPassE1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(pRegister1Layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(lbEEmail1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(lbEFax1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(lbEPhone1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(pRegister1Layout.createSequentialGroup()
                                                .addComponent(lbEName1, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(0, 0, Short.MAX_VALUE))))
                                    .addGroup(pRegister1Layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(lbERole1, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(lbEAddress1, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addGap(18, 18, 18))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pRegister1Layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addGap(23, 23, 23)))
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(txtPhoneE1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                                .addComponent(txtFaxE1, javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(txtEmailE1, javax.swing.GroupLayout.Alignment.TRAILING))
                            .addComponent(cbRoleE1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtNameE1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(83, Short.MAX_VALUE))
            .addGroup(pRegister1Layout.createSequentialGroup()
                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pRegister1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(txtIdE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pRegister1Layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(txtflag1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pRegister1Layout.createSequentialGroup()
                        .addGap(210, 210, 210)
                        .addComponent(btnAdd1, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(97, 97, 97)
                        .addComponent(btnEdit1)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pRegister1Layout.setVerticalGroup(
            pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pRegister1Layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(jLabel3)
                .addGap(32, 32, 32)
                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pRegister1Layout.createSequentialGroup()
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtNameE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbEName1))
                        .addGap(18, 18, 18)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtPhoneE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbEPhone1))
                        .addGap(24, 24, 24)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtFaxE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbEFax1))
                        .addGap(22, 22, 22)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtEmailE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbEEmail1))
                        .addGap(18, 18, 18)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lbEAddress1)
                            .addComponent(txtAddressE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(28, 28, 28)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbRoleE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbERole1)
                            .addComponent(txtPassE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(pRegister1Layout.createSequentialGroup()
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(txtIdVac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbDeptnum1)
                            .addComponent(txtNameDept, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(24, 24, 24)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbSecName1)
                            .addComponent(txtNameSec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(22, 22, 22)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbDesignName1)
                            .addComponent(txtNameDesign, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbEUser1)
                            .addComponent(txtUserE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(31, 31, 31)
                        .addComponent(lbEPass1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(7, 7, 7)
                .addComponent(txtIdE1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addGroup(pRegister1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAdd1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnEdit1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(58, 58, 58)
                .addComponent(txtflag1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(22, 22, 22))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 749, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(pRegister1, javax.swing.GroupLayout.DEFAULT_SIZE, 729, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 512, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(pRegister1, javax.swing.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE)
                    .addContainerGap()))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnEdit1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEdit1ActionPerformed
        // TODO add your handling code here:
        setVisible(false);
    }//GEN-LAST:event_btnEdit1ActionPerformed

    private void btnAdd1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdd1ActionPerformed
        int flag = JOptionPane.showConfirmDialog(this, "Do you want to add ?");
        if (flag == 0) {

            try {
                VacancyfilldetailsBO tmpVDBO = new VacancyfilldetailsBO();
                tmpVDBO.fillVacancybyNewEmployee(
                        txtNameDept.getText(),
                        txtNameSec.getText(),
                        txtNameDesign.getText(),
                        txtUserE1.getText(),
                        txtPassE1.getPassword(),
                        cbRoleE1.getSelectedItem(),
                        txtNameE1.getText(),
                        txtAddressE1.getText(),
                        txtPhoneE1.getText(),
                        txtFaxE1.getText(),
                        txtEmailE1.getText());
                JOptionPane.showMessageDialog(this, tmpVDBO.getSuccess());
                txtNameE1.setText("");
                txtPhoneE1.setText("");
                txtEmailE1.setText("");
                txtFaxE1.setText("");
                txtAddressE1.setText("");
                txtUserE1.setText("");
                txtPassE1.setText("");
                txtNameDept.setText("");
                txtNameSec.setText("");
                txtNameDesign.setText("");
                setVisible(false);

            } catch (Error ex) {
                JOptionPane.showMessageDialog(this, ex.getMessage());
            } 
        }
    }//GEN-LAST:event_btnAdd1ActionPerformed

    private void txtPhoneE1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPhoneE1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtPhoneE1ActionPerformed

    private void txtPhoneE1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPhoneE1KeyTyped
        // TODO add your handling code here:
        char c = evt.getKeyChar();
        if (!(Character.isDigit(c) || c == KeyEvent.VK_BACK_SPACE || c == KeyEvent.VK_0)) {
            evt.consume();
        }
    }//GEN-LAST:event_txtPhoneE1KeyTyped

    private void txtFaxE1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtFaxE1KeyTyped
        // TODO add your handling code here:
        char c = evt.getKeyChar();
        if (!(Character.isDigit(c) || c == KeyEvent.VK_BACK_SPACE || c == KeyEvent.VK_0)) {
            evt.consume();
        }
    }//GEN-LAST:event_txtFaxE1KeyTyped

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FillVacancyDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FillVacancyDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FillVacancyDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FillVacancyDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                FillVacancyDialog dialog = new FillVacancyDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnAdd1;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnEdit;
    private javax.swing.JButton btnEdit1;
    private javax.swing.JButton btnSearch;
    private javax.swing.JComboBox cbNameDesign;
    private javax.swing.JComboBox cbNameSec;
    private javax.swing.JComboBox cbNumberDept;
    private javax.swing.JComboBox cbRoleE;
    private javax.swing.JComboBox cbRoleE1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel lbDeptnum;
    private javax.swing.JLabel lbDeptnum1;
    private javax.swing.JLabel lbDesignName;
    private javax.swing.JLabel lbDesignName1;
    private javax.swing.JLabel lbEAddress;
    private javax.swing.JLabel lbEAddress1;
    private javax.swing.JLabel lbEEmail;
    private javax.swing.JLabel lbEEmail1;
    private javax.swing.JLabel lbEFax;
    private javax.swing.JLabel lbEFax1;
    private javax.swing.JLabel lbEName;
    private javax.swing.JLabel lbEName1;
    private javax.swing.JLabel lbEPass;
    private javax.swing.JLabel lbEPass1;
    private javax.swing.JLabel lbEPhone;
    private javax.swing.JLabel lbEPhone1;
    private javax.swing.JLabel lbERole;
    private javax.swing.JLabel lbERole1;
    private javax.swing.JLabel lbEUser;
    private javax.swing.JLabel lbEUser1;
    private javax.swing.JLabel lbSecName;
    private javax.swing.JLabel lbSecName1;
    private javax.swing.JPanel pRegister;
    private javax.swing.JPanel pRegister1;
    private javax.swing.JTextField txtAddressE;
    private javax.swing.JTextField txtAddressE1;
    private javax.swing.JTextField txtEmailE;
    private javax.swing.JTextField txtEmailE1;
    private javax.swing.JTextField txtFaxE;
    private javax.swing.JTextField txtFaxE1;
    private javax.swing.JTextField txtIdE;
    private javax.swing.JTextField txtIdE1;
    private javax.swing.JTextField txtIdVac;
    private javax.swing.JTextField txtNameDept;
    private javax.swing.JTextField txtNameDesign;
    private javax.swing.JTextField txtNameE;
    private javax.swing.JTextField txtNameE1;
    private javax.swing.JTextField txtNameSec;
    private javax.swing.JPasswordField txtPassE;
    private javax.swing.JPasswordField txtPassE1;
    private javax.swing.JTextField txtPhoneE;
    private javax.swing.JTextField txtPhoneE1;
    private javax.swing.JTextField txtUserE;
    private javax.swing.JTextField txtUserE1;
    private javax.swing.JTextField txtflag;
    private javax.swing.JTextField txtflag1;
    // End of variables declaration//GEN-END:variables
}
